//
//  UIColor+GKColor.m
//  jinwan
//
//  Created by 王尧 on 2017/5/27.
//  Copyright © 2017年 wy. All rights reserved.
//

#import "UIColor+GKColor.h"


NSString *const C666666 = @"#666666";//black
NSString *const C4398F3 = @"#4398F3";

@implementation UIColor (GKColor)

+ (UIColor *)gk_colorWithHexString:(NSString *)str
{
    return [UIColor gk_colorWithHexString:str alpha:1.0];
}

+ (UIColor *)gk_colorWithHexString:(NSString *)str alpha:(CGFloat)alpha
{
    const char *cStr = [str cStringUsingEncoding:NSASCIIStringEncoding];
    long x = strtol(cStr+1, NULL, 16);
    return [UIColor gk_colorWithHex:x alpha:alpha];
}

+ (UIColor *)gk_colorWithHex:(long)col alpha:(CGFloat)alpha
{
    unsigned char r, g, b;
    b = col & 0xFF;
    g = (col >> 8) & 0xFF;
    r = (col >> 16) & 0xFF;
    return [UIColor colorWithRed:(float)r/255.0f green:(float)g/255.0f blue:(float)b/255.0f alpha:alpha];
}

+ (UIColor *)black_666666
{
    return [UIColor gk_colorWithHexString:C666666];
}

+ (UIColor *)blue_4398F3
{
    return [UIColor gk_colorWithHexString:C4398F3];
}

+ (UIColor *)custom_color:(NSString *)colorStr
{
     return [UIColor gk_colorWithHexString:colorStr];
}

+ (UIColor *)mainColor
{
    return [UIColor gk_colorWithHexString:@"#FFA91E23"];
}
@end
